package org.example.everyday;

public class Lc172 {
    public static void main(String[] args) {
        Lc172 lc172 = new Lc172();
//        int result = lc172.trailingZeroes(10);
        int result = lc172.solution1(10);
        System.out.println(result);
    }

    public int trailingZeroes(int n) {
        int ans = 0;
        for (int i = 5; i <= n; i += 5) {
            for(int x = i; x % 5 == 0; x /= 5){
                ++ans;
            }
        }
        return ans;
    }

    public int solution1(int n ){
        int ans = 0;
        while (n != 0){
            n /= 5;
            ans += n;
        }
        return ans;
    }
}
